package Day36.test2;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test3 {
    public static void main(String[] args) {
        List<Account> accountList = new ArrayList<>();
        accountList.add(new Account(100f,"123456"));
        accountList.add(new Account(100000f,"888888"));
        accountList.add(new Account(200f,"666666"));
        //遍历list集合


        Map<Long,Account> accountMap = new HashMap<>();
        for (Account account :accountList) {
            accountMap.put(account.getId(),account);
        }

        for(Map.Entry<Long,Account> entry : accountMap.entrySet()){
            System.out.println(entry.getKey()+":"+(entry.getValue().getBalance()));
        }

    }
}
